package com.magoldeditor.view;

import javax.swing.JMenuItem;

import com.magoldeditor.controller.MenuMouseListener;

/**
 * 
 * @author Velconia
 * @version v.1.0
 */
public class MaEditorMenuItem extends JMenuItem {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * menu listener
	 */
	private MenuMouseListener listener = null;
	
	/**
	 * 
	 * @param mouseListener
	 */
	public MaEditorMenuItem(MenuMouseListener mouseListener) {
		super();
		this.listener = mouseListener;
		this.addActionListener(mouseListener);
	}
	
	@Override
	public void setText(String text) {
		super.setText(text);
		if (this.listener != null) this.listener.setItemName(text);
		System.err.println(text);
	}
}